for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
/**
* @param {array} names - list of names
* @param {integer} winnerCount - total winner that picked from names
winnerCount
* @returns {array} - list of winner
*/
export function getRandomWinners(names, winnerCount = 1) {
for (let i = names.length - 1; i > 0; i--) {
const j = Math.floor(Math.random() * (i + 1));
[names[i], names[j]] = [names[j], names[i]];
names
/** global: names */
This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.
To learn more about declaring variables in Javascript, see the MDN.
j
/** global: j */
i
/** global: i */
}
return names.slice(0, winnerCount);
* @param {string} string - text that will be extracted
* @returns {array} list of extracted text
export function extractMessage(string) {
const regex = /"[^"]+"|[^\s]+/g;
return string.match(regex).map((s) => s.replace(/"(.+)"/, '$1'));